from django.db import models

# Create your models here.
class BookClass(models.Model):
    name=models.CharField(max_length=20,verbose_name=u"分类名称")
    def __str__(self):
        return self.name

class BookInfo(models.Model):
    bookclass=models.ForeignKey(BookClass,on_delete=models.CASCADE,verbose_name=u"图书分类",null=True,blank=True)
    name=models.CharField(max_length=50,verbose_name=u"图书名称")
    price=models.IntegerField(verbose_name=u"价格",default=20)
    autor=models.CharField(max_length=20,verbose_name=u"作者")
    imgsrc=models.ImageField(upload_to='static/images/',default='static/images/default.jpg',verbose_name=u"图片封面")
    def __str__(self):
        return self.name

class CaseDemoUser(models.Model):
    username=models.CharField(max_length=20,verbose_name=u"用户名")
    password=models.CharField(max_length=20,verbose_name=u"密码")
    sex=models.CharField(max_length=2,verbose_name=u"性别",default="男")
    age=models.IntegerField(verbose_name=u"年龄",default=20)
    email=models.EmailField(verbose_name=u"邮箱",default="123456789@qq.com")
    useronlyID=models.AutoField(primary_key=True,verbose_name=u"用户ID")
    class Meta:
        db_table = 'CaseDemoUser'
